home *** CD-ROM | disk | FTP | other *** search
/ PC Home 49 / PC_Home_Issue_49.iso / lldemo / lldemo.shr / ROSETTA.EXE / ROSETTA.DXR / 00591_page scripts.ls < prev    next >
Encoding:
Text File  |  1996-06-24  |  5.6 KB  |  212 lines

  1. on setPage p
  2.   set the text of cast "Page" to string(p)
  3.   return p
  4. end
  5.  
  6. on initPage
  7.   global gResponseOrder, gChallengeOrder, gChallengeIndex, gFlowType, gWorth, gPage, gPageScore
  8.   if inChallenge() and (gFlowType <> #SCRAMBLE) and (gFlowType <> #sms) then
  9.     subtractPageScore(gPage)
  10.   end if
  11.   set gWorth to 4
  12.   set gPageScore to 0
  13.   set gChallengeOrder to line random(24) of the text of cast "Rand 4 List"
  14.   set gResponseOrder to "1234"
  15.   set gChallengeIndex to 1
  16. end
  17.  
  18. on doPage blindfold, Cycle, mode, timer
  19.   global gStopTicks, gTimerTicks
  20.   if blindfold and inChallenge() then
  21.     hideAllResponses()
  22.     drawChallenge()
  23.     giveChallenge()
  24.     hideChallenge()
  25.     drawAllResponses()
  26.     if Cycle then
  27.       go(mode & "cycle")
  28.     end if
  29.   else
  30.     if inChallenge() then
  31.       drawAllResponses()
  32.       drawChallenge()
  33.       giveChallenge()
  34.     else
  35.       drawAllResponses()
  36.     end if
  37.     if Cycle then
  38.       go(mode & "cycle")
  39.     end if
  40.   end if
  41.   if timer and Cycle then
  42.     set gStopTicks to -1
  43.   else
  44.     set gStopTicks to the ticks + gTimerTicks
  45.   end if
  46. end
  47.  
  48. on changeScreen adj
  49.   global gPage, gNumPages, gScreenMode, gDictNum
  50.   set newPg to gPage
  51.   if ((newPg + adj) <= gNumPages) and ((newPg + adj) >= 1) then
  52.     if getaProp(gScreenMode, #SNDRESP) <> #NONE then
  53.       normalCenterSpeaker()
  54.     end if
  55.     if getaProp(gScreenMode, #SPECIAL) = #DICT then
  56.       hideDict()
  57.       hideTextPuppets()
  58.       hide6()
  59.       set gDictNum to 0
  60.     end if
  61.     set newPg to setPage(newPg + adj)
  62.     updateStage()
  63.     if the stillDown then
  64.       repeat while the lastClick < 30
  65.         nothing()
  66.       end repeat
  67.       set nextTime to the ticks + 18
  68.       repeat while the stillDown
  69.         if (the ticks > nextTime) and ((newPg + adj) <= gNumPages) and ((newPg + adj) >= 1) then
  70.           set newPg to setPage(newPg + adj)
  71.           set nextTime to the ticks + 18
  72.         end if
  73.         updateStage()
  74.       end repeat
  75.     end if
  76.     hideOverlay()
  77.     endOfPage(newPg)
  78.   end if
  79. end
  80.  
  81. on doFirstState newState
  82.   global gPage, gMode, initGlobals, gNextPage, initGlobals, gSMSAllowBrowse, gNextChap, gBlindfold, gNextUnit, gNewChap, gTest, gNextPathList
  83.   set act to getaProp(newState, #action)
  84.   if act = #finishedAll then
  85.     set goto to "endScreen"
  86.   else
  87.     if act = #finishedTest then
  88.       set goto to "endScreen"
  89.     else
  90.       if act = #enterTest then
  91.         clearScore()
  92.         set gTest to 1
  93.       end if
  94.     end if
  95.   end if
  96.   if (act = #normal) or (act = #enterTest) then
  97.     set mode to getaProp(newState, #mode)
  98.     set m to value(mode)
  99.     if m = 0 then
  100.       if mode = "A" then
  101.         set m to 13
  102.       else
  103.         if mode = "B" then
  104.           set m to 14
  105.         else
  106.           if mode = "C" then
  107.             set m to 15
  108.           end if
  109.         end if
  110.       end if
  111.     end if
  112.     set mode to getAt(["122", "120", "102", "121", "112", "211", "210", "201", "221", "212", "021", "012", "111", "110", "011"], m)
  113.     translateMode(mode)
  114.     set gBlindfold to getaProp(newState, #blindfold)
  115.     set uc to mapUnitChap(getaProp(newState, #nextunitchap))
  116.     set gNextUnit to getaProp(uc, #unit)
  117.     set gNextChap to getaProp(uc, #chapter)
  118.     set uc to mapUnitChap(getaProp(newState, #unitchap))
  119.     set unit to getaProp(uc, #unit)
  120.     set chapter to getaProp(uc, #chapter)
  121.     set language to getaProp(newState, #language)
  122.     set gNextPathList to findChapPaths(language, gNextUnit, gNextChap)
  123.     set prevChap to gNewChap
  124.     set gNewChap to makeChapStr(language, unit, chapter)
  125.     if gNewChap <> prevChap then
  126.       if newChap() then
  127.         set gNewChap to EMPTY
  128.         set goto to "error"
  129.       end if
  130.     end if
  131.     if (goto <> "endScreen") and (goto <> "error") then
  132.       set gPage to setPage(getaProp(newState, #page))
  133.       set gNextPage to getaProp(newState, #nextPage)
  134.       set gSMSAllowBrowse to getaProp(newState, #allowBrowse)
  135.       set goto to gMode
  136.     end if
  137.   end if
  138.   return goto
  139. end
  140.  
  141. on endOfPage newPg
  142.   global gPage, gNumPages, gFlowType, gMode, gBlindfold, gNexQuad, gCycle, gTimer, gNextPage, gNextUnit, gNextChap, gCurQuad, gPageScore
  143.   set ret to 1
  144.   set goto to EMPTY
  145.   set oldMode to gMode
  146.   if gFlowType = #sms then
  147.     if (gPageScore = 10) or isBrowse() then
  148.       set allright to #wasRight
  149.     else
  150.       set allright to #wasWrong
  151.     end if
  152.     set newState to getSMSNextMode(allright)
  153.     set goto to doFirstState(newState)
  154.     if goto = "error" then
  155.       set goto to "endScreen"
  156.     end if
  157.   else
  158.     if gFlowType = #SCRAMBLE then
  159.       translateMode(randMode())
  160.       set gBlindfold to random(4) = 1
  161.       set gPage to setPage(gNextPage)
  162.       set gNextPage to randPage(gNextPage)
  163.       set goto to gMode
  164.     else
  165.       if newPg > gNumPages then
  166.         set goto to "endScreen"
  167.       else
  168.         set gPage to setPage(newPg)
  169.         set gNextPage to (gPage mod 10) + 1
  170.         set goto to gMode & "loop"
  171.       end if
  172.     end if
  173.   end if
  174.   if goto <> "endScreen" then
  175.     initPage()
  176.     checkLoad()
  177.     newPage(gNexQuad, gNextUnit, gNextChap, gNextPage)
  178.   end if
  179.   if tail(goto, 4) = "loop" then
  180.     set notBlind to not gBlindfold or isBrowse()
  181.     set show to notBlind and (pictMode() = #response)
  182.     if show then
  183.       hideChallenge()
  184.       hideAllResponses()
  185.       setResponsePicts(getQuadBase(gCurQuad))
  186.     end if
  187.     if inChallenge() then
  188.       if (gFlowType <> #SCRAMBLE) and (gFlowType <> #sms) then
  189.         subtractPageScore(gPage)
  190.       end if
  191.       drawText()
  192.       doPage(gBlindfold, gCycle, gMode, gTimer)
  193.       if gCycle then
  194.         set goto to gMode & "cycle"
  195.       end if
  196.     else
  197.       drawText()
  198.     end if
  199.   else
  200.     stopMouseTrap()
  201.   end if
  202.   if gMode <> oldMode then
  203.     goChangeMeta("initPlay")
  204.   else
  205.     if goto = "endScreen" then
  206.       goChangeMeta(goto)
  207.     else
  208.       go(goto)
  209.     end if
  210.   end if
  211. end
  212.